home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- _root.char._x += speed;
- bridgeSFX = new Sound(this);
- bridgeSFX.attachSound("bridge");
- if(_root.paus3)
- {
- speed = 0;
- maxspeed = 0;
- }
- if(!_root.paus3)
- {
- grav++;
- _Y = _Y + grav;
- while(_root.ground.hitTest(_X,_Y,true))
- {
- _Y--;
- grav = 0;
- }
- if(this._currentframe != 45)
- {
- if(Key.isDown(_global.rightkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30)
- {
- _xscale = scale;
- speed++;
- if(speed >= maxspeed)
- {
- speed = maxspeed;
- }
- if(_root.ground.hitTest(_X,_Y + 7,true))
- {
- this.gotoAndStop("run");
- }
- }
- else if(Key.isDown(_global.leftkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30)
- {
- _xscale = - scale;
- speed--;
- if(speed <= maxspeed * -1)
- {
- speed = maxspeed * -1;
- }
- if(_root.ground.hitTest(_X,_Y + 7,true))
- {
- this.gotoAndStop("run");
- }
- }
- else
- {
- if(speed > 0)
- {
- speed--;
- if(speed <= 0)
- {
- speed = 0;
- }
- }
- else if(speed < 0)
- {
- speed++;
- if(speed >= 0)
- {
- speed = 0;
- }
- }
- if(_root.ground.hitTest(_X,_Y + 3,true) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 50)
- {
- this.gotoAndStop("idle");
- }
- }
- if(_root.fallDeath.hitTest(_X,_Y,true))
- {
- _root.sfx.gotoAndStop("fallDeath");
- _global.deathtype = 1;
- this.gotoAndPlay("fall");
- }
- if(this.hitTest(_root.lvl1bound))
- {
- _root.gotoAndStop("level1-mini");
- _root.camera.gotoAndStop("fader");
- }
- if(this._currentframe != 25 && this._currentframe != 30)
- {
- damaged = 0;
- }
- if(_root.death.hitTest(_X,_Y,true))
- {
- _root.gotoAndStop("death");
- }
- if(_root.bridgeBeam.hitboxBridge.hitTest(_root.char.hitboxLevel))
- {
- _root.arrowHelp.gotoAndStop(2);
- }
- if(_root.bridgeBeam.hitboxBridge2.hitTest(_root.char.hitboxLevel))
- {
- _root.arrowHelp.gotoAndStop(2);
- _root.bridgeBeam.gotoAndPlay(2);
- _root.ground.gotoAndPlay(2);
- }
- if(Key.isDown(p) || Key.isDown(_global.esc) && !paus3)
- {
- _root.pauseMenu.gotoAndStop(5);
- _root.paus3 = 1;
- }
- if(Key.isDown(_global.upkey) && _root.ground.hitTest(_X,_Y + 7,true) || _root.ground2.hitTest(_X,_Y + 7,true) && grav <= 4)
- {
- grav = - jumpHeight;
- _Y = _Y - 4;
- this.gotoAndStop("jump");
- if(_root.sfxjc._currentframe <= 20)
- {
- _root.sfx.gotoAndPlay("jump1");
- }
- if(_root.sfxjc._currentframe >= 20)
- {
- _root.sfx.gotoAndPlay("jump2");
- }
- }
- attackFrame = ["attack_1","attack_2"];
- attack = 0;
- if(!Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey) && !Key.isDown(_global.upkey) && !jumping && !attack)
- {
- if(this._currentframe != 10 && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
- {
- if(Key.isDown(_global.z) || Key.isDown(_global.spc))
- {
- _root.char.gotoAndStop(attackFrame[random(attackFrame.length)]);
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box) && _root.box._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box2) && _root.box2._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box3) && _root.box3._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && Key.isDown(_global.spc) && this.hitboxKick.hitTest(_root.box4) && _root.box4._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- }
- if(this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
- {
- attack = 0;
- }
- }
- if(!attack && this._currentframe != 10 && this._currentframe != 50 && this._currentframe != 15 && this._currentframe != 40 && _root.camera.specialBar._currentframe == 5 && !Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey))
- {
- if(Key.isDown(_global.a))
- {
- this.gotoAndStop("special");
- attack = 1;
- _root.camera.specialBar.gotoAndStop(1);
- _global.fucker = 0;
- }
- }
- }
- wallsLeft = 10;
- i = 1;
- while(i <= wallsLeft)
- {
- wallLeft = _root["wallLeft" + i];
- if(Key.isDown(37))
- {
- if(wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height,true))
- {
- speed = 0;
- }
- }
- i++;
- }
- wallsRight = 10;
- i = 1;
- while(i <= wallsRight)
- {
- wallRight = _root["wallRight" + i];
- if(Key.isDown(39))
- {
- if(wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height,true))
- {
- speed = 0;
- }
- }
- i++;
- }
- tuska = 25;
- i = 1;
- while(i <= tuska)
- {
- tusk = _root["tusk" + i];
- if(this.hitTest(tusk))
- {
- tusk.gotoAndStop(7);
- _global.score += 1;
- if(_global.sounds == 1)
- {
- tuskPickup = new Sound(this);
- tuskPickup.attachSound("tuskPickup");
- tuskPickup.start();
- }
- }
- i++;
- }
- tuskb = 25;
- i = 1;
- while(i <= tuskb)
- {
- clump = _root["clump" + i];
- if(this.hitTest(clump))
- {
- clump.gotoAndStop(10);
- _global.score += 5;
- if(_global.sounds == 1)
- {
- tuskPickup = new Sound(this);
- tuskPickup.attachSound("tuskPickup");
- tuskPickup.start();
- }
- }
- i++;
- }
- if(_root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 4,false) || _root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 12,false) || _root.ground.hitTest(_X + _width / 4 + ex,_Y - _height,false))
- {
- _X = _X - speed;
- }
- if(_root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 4,false) || _root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 12,false) || _root.ground.hitTest(_X - _width / 4 - ex,_Y - _height,false))
- {
- _X = _X + speed;
- }
- if(grav >= 5)
- {
- this.gotoAndStop("fall2");
- }
- }
- }
-